Component({
  data: {
    select: 0,
    list: [{
        iconPath: "/images/home.png",
        pagePath: "/pages/index/index",
        selectedIconPath: "/images/home_fill.png",
        text: "首页",
        type: 0
      },
      {
        iconPath: "/images/cate.png",
        pagePath: "/pages/classify/classify",
        selectedIconPath: "/images/cate_fill.png",
        text: "分类",
        type: 0
      },
      {
        
        type: 1,
        pagePath: "/pages/publish/publish"
      },
      {
        iconPath: "/images/collection.png",
        pagePath: "/pages/collection/collection",
        selectedIconPath: "/images/collection-fill.png",
        text: "收藏夹",
        type: 0
      },
      {
        iconPath: "/images/my.png",
        pagePath: "/pages/me/me",
        selectedIconPath: "/images/my_fill.png",
        text: "我的",
        type: 0
      },
    ]
  },
  methods: {
    selectPage(e) {
      const { index, page, type } = e.currentTarget.dataset;
      // 选择的是四个普通的页面
      if(index !== this.data.select && type === 0) {
        wx.switchTab({
          url: page,
        })

      // 跳转的是发布页面
      } else {
        wx.navigateTo({
          url: page,
        })
      }
    }
  }
})